package com.shchuangzhi.smartguard;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;

import com.shchuangzhi.smartguard.core.Consts;
import com.shchuangzhi.smartguard.core.DBHelper;

/**
 * Created by j_hu on 5/4/17.
 */

public class ResetPreference extends YesOrNoPreference {
    public ResetPreference(Context ctx, AttributeSet attrs) {
        super(ctx, attrs);
    }
    @Override
    protected void OnPositiveButtonClick(Context ctx) {
        new DBHelper(ctx).reset();
        SharedPreferences sp = ctx.getSharedPreferences(Consts.APP_FULL_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();
        editor.clear();
        editor.commit();
    }

    @Override
    protected void OnNegativeButtonClick(Context ctx) {

    }
}
